import request from '@/utils/request'
/**
 *
 * @returns 获取组织架构数据
 */
export const getDepartmentsApi = () => {
  return request({
    url: '/company/department'
  })
}
/**
 * 删除部门
 * @param {*} id 部门id
 * @returns
 */
export const delDepartment = (id) => {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}
/**
 * 获取添加部门弹出框中的管理员姓名
 * @returns
 */
export const getDepartmentUser = () => {
  return request({
    url: '/sys/user/simple'
  })
}
/**
 * 添加部门功能
 * @param {*} data 需要的form表单数据
 * @returns
 */
export const getAddDepartment = (data) => {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}
/**
 *  获取部门详细
 * @param {*} id 部门id
 * @returns
 */
export const getFormDataApi = (id) => {
  return request({
    url: `/company/department/${id}`
  })
}
/**
 * 修改部门详细
 * @param {*} id 部门id
 * @returns
 */
export const editDepartmentApi = (data) => {
  return request({
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data
  })
}
